package com.ywy.config;

import com.ywy.utils.UploadUtil;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * WebMVC配置
 *
 * @author ywy
 * @date 2021/12/28 9:38
 */
@EnableCaching
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 映射上传文件的路径
        registry.addResourceHandler("/upload/**").addResourceLocations("file:///" + UploadUtil.uploadDir + "/");
    }
}
